Line and step line series
A LineSeries joins its points with a line, straight or curved, and can fill the area below it. A StepLineSeries
joins them with horizontal and vertical segments instead. Both series share almost every property, so this article covers
them together: everything below applies to both, except LineSmoothness, which only the line series has.
This article highlights the most used features. Every property is listed in the API explorer:
LineSeries and
StepLineSeries.
In XAML, declare them as XamlLineSeries and XamlStepLineSeries.
Basic line
Set the Values of the series and add it to the chart. Every point is drawn with a geometry, a circle by default.
The second generic argument changes the geometry, the second series in this sample uses a StarGeometry.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Lines.Basic.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Lines.Basic;assembly=ViewModelsSamples"
xmlns:draw="clr-namespace:LiveChartsCore.SkiaSharpView.Drawing.Geometries;assembly=LiveChartsCore.SkiaSharpView"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Title>
<lvc:XamlDrawnLabelVisual
Text="My chart title"
TextSize="25"
Padding="15"/>
</lvc:CartesianChart.Title>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
Values="{Binding Values1}"
Fill="{x:Null}"
GeometrySize="20"/>
<lvc:XamlLineSeries
x:TypeArguments="x:Int32, draw:StarGeometry"
Values="{Binding Values2}"
Fill="{x:Null}"
GeometrySize="20"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
namespace ViewModelsSamples.Lines.Basic;
public class ViewModel
{
public double[] Values1 { get; set; } =
[2, 1, 3, 5, 3, 4, 6];
public int[] Values2 { get; set; } =
[4, 2, 5, 2, 4, 5, 3];
}
Straight or smooth lines
LineSmoothness goes from 0 to 1: 0 draws straight segments between the points and 1 draws the most curved
line. Values outside that range are clamped to it. Setting GeometrySize to 0 hides the points.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Lines.Straight.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Lines.Straight;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<!--
The line smoothness property controls the curve between points
it goes from 0 to 1, where 0 is straight and 1 is the most curved.
-->
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
Values="{Binding Values1}"
Fill="{x:Null}"
GeometrySize="0"
LineSmoothness="0"/>
<lvc:XamlLineSeries
Values="{Binding Values2}"
Fill="{x:Null}"
GeometrySize="0"
LineSmoothness="1"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
namespace ViewModelsSamples.Lines.Straight;
public class ViewModel
{
public double[] Values1 { get; set; } =
[5, 0, 5, 0, 5, 0];
public double[] Values2 { get; set; } =
[7, 2, 7, 2, 7, 2];
}
Area
The Fill paint fills the area under the line. Set Fill to null to draw only the line, or set Stroke and the
geometry paints to null to draw only the area.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Lines.Area.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Lines.Area;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart
DrawMarginFrame="{lvc:Frame
Stroke={lvc:SolidColorPaint Color='64b4b4b4'},
Fill={lvc:SolidColorPaint Color='32dcdcdc'}}">
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
Values="{Binding Values}"
Fill="{lvc:SolidColorPaint Color='6495ED'}"
Stroke="{x:Null}"
GeometryFill="{x:Null}"
GeometryStroke="{x:Null}"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
namespace ViewModelsSamples.Lines.Area;
public class ViewModel
{
public double[] Values { get; set; } =
[-2, -1, 3, 5, 3, 4, 6];
}
Stroke and fill paints
When Stroke, Fill, GeometryStroke or GeometryFill are not set, LiveCharts picks them from the current theme,
based on the position of the series in the chart's series collection. Set them to use your own colors.
Stroke draws the line:

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Stroke = new SolidColorPaint(SKColors.Green) { StrokeThickness = 1 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
}
};
Fill draws the area. The alpha channel goes from 0 (transparent) to 255 (opaque):

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Fill = new SolidColorPaint(SKColors.Blue.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Fill = new SolidColorPaint(SKColors.Red.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Fill = new SolidColorPaint(SKColors.Green.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
Paints can also draw gradients and dashed lines, see the Paints article.
Point geometries
GeometryFill and GeometryStroke paint the shape drawn at each point, and GeometrySize sets its size. While
GeometryStroke is not set, the theme derives it from the series' Stroke (when Stroke is a SolidColorPaint),
so the points match the line.

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.AliceBlue), // mark
GeometryStroke = new SolidColorPaint(SKColors.Gray) { StrokeThickness = 4 } // mark
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.IndianRed), // mark
GeometryStroke = new SolidColorPaint(SKColors.DarkSalmon) { StrokeThickness = 8 } // mark
}
};
The shape itself can be any geometry. The next sample uses, in order, the default circle, a predefined
StarGeometry (the LiveChartsCore.SkiaSharpView.Drawing.Geometries namespace has more, such as CrossGeometry,
DiamondGeometry and RectangleGeometry), an SVG path through VariableSVGPathGeometry and GeometrySvg, and a
geometry drawn with the SkiaSharp API (MyGeometry).

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Lines.Custom.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Lines.Custom;assembly=ViewModelsSamples"
xmlns:draw="clr-namespace:LiveChartsCore.SkiaSharpView.Drawing.Geometries;assembly=LiveChartsCore.SkiaSharpView"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
Values="{Binding Values1}"
Fill="{x:Null}"
GeometrySize="20"/>
<!--
Use the generic type arguments to set the type of the geometry to draw,
here are many predefined geometries in the LiveChartsCore.SkiaSharpView.Drawing.Geometries
namespace, for example, the StarGeometry, CrossGeometry, RectangleGeometry and DiamondGeometry
The first type argument is the type of data, in this case double (parsed from the values string).
The second type argument is the type of geometry to draw.
-->
<lvc:XamlLineSeries
x:TypeArguments="x:Double, draw:StarGeometry"
Values="{Binding Values2}"
Fill="{x:Null}"
GeometrySize="20" />
<!--
You can also use SVG paths to draw the geometry
the VariableSVGPathGeometry can change the drawn path at runtime
-->
<lvc:XamlLineSeries
x:TypeArguments="x:Double, draw:VariableSVGPathGeometry"
GeometrySvg="{Binding PinPath}"
Values="{Binding Values3}"
Fill="{x:Null}"
GeometrySize="20"/>
<!--
Finally you can also use SkiaSharp to draw your own geometry
-->
<lvc:XamlLineSeries
x:TypeArguments="x:Double, vms:MyGeometry"
Values="{Binding Values4}"
Fill="{x:Null}"
GeometrySize="20"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
using LiveChartsCore.Drawing;
namespace ViewModelsSamples.Lines.Custom;
public class ViewModel
{
public double[] Values1 { get; set; } =
[2, 1, 4, 2, 2, -5, -2];
public double[] Values2 { get; set; } =
[3, 3, -3, -2, -4, -3, -1];
public double[] Values3 { get; set; } =
[-2, 2, 1, 3, -1, 4, 3];
public double[] Values4 { get; set; } =
[4, 5, 2, 4, 3, 2, 1];
public string PinPath { get; set; } =
SVGPoints.Pin;
}
using LiveChartsCore.Drawing;
using LiveChartsCore.SkiaSharpView.Drawing;
namespace ViewModelsSamples.Lines.Custom;
public class MyGeometry : BoundedDrawnGeometry, IDrawnElement<SkiaSharpDrawingContext>
{
public void Draw(SkiaSharpDrawingContext context)
{
var paint = context.ActiveSkiaPaint;
var canvas = context.Canvas;
canvas.DrawRect(X, Y, Width, Height, paint);
canvas.DrawLine(X, Y, X + Width, Y + Height, paint);
canvas.DrawLine(X + Width, Y, X, Y + Height, paint);
}
}
Customize each point
The PointMeasured event (a command in the XAML samples) runs every time a point gets its size and position, and
gives access to both the data and the drawn shape. This sample stores a wind direction in each data point and rotates
an arrow geometry to match it.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.Lines.CustomPoints.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Lines.CustomPoints;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries
x:TypeArguments="vms:DataPoint, vms:ArrowGeometry"
GeometrySize="34"
Fill="{x:Null}"
Values="{Binding Values}"
PointMeasuredCommand="{Binding PointMeasuredCommand}"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using LiveChartsCore;
using LiveChartsCore.Kernel;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
using SkiaSharp;
namespace ViewModelsSamples.Lines.CustomPoints;
public partial class ViewModel : ObservableObject
{
public ViewModel()
{
LiveCharts.Configure(config =>
{
// The map is used to map the data points to the series
// to learn more about mappers visit:
// https://livecharts.dev/docs/maui/2.2.0/Overview.Mappers
config.HasMap<DataPoint>(
(dataPoint, index) => new(index, dataPoint.Value));
});
}
public DataPoint[] Values { get; set; } =
[
new DataPoint { Value = 4, Rotation = 0 },
new DataPoint { Value = 6, Rotation = 20 },
new DataPoint { Value = 8, Rotation = 90 },
new DataPoint { Value = 2, Rotation = 176 },
new DataPoint { Value = 7, Rotation = 55 },
new DataPoint { Value = 9, Rotation = 226 },
new DataPoint { Value = 3, Rotation = 320 }
];
// The pnt measured command/event is triggered when a point size
// and position is calculated, for this example we use a command,
// but you could also subscribe to the series PointMeasured event.
[RelayCommand]
public void OnPointMeasured(ChartPoint point)
{
var dataPoint = (DataPoint)point.Context.DataSource!;
point.Context.Visual!.RotateTransform = dataPoint.Rotation;
}
public DataPoint[] Fetch()
{
return [
new DataPoint { Value = 4, Rotation = 0 },
new DataPoint { Value = 6, Rotation = 20 },
new DataPoint { Value = 8, Rotation = 90 },
new DataPoint { Value = 2, Rotation = 176 },
new DataPoint { Value = 7, Rotation = 55 },
new DataPoint { Value = 9, Rotation = 226 },
new DataPoint { Value = 3, Rotation = 320 }
];
}
}
public class DataPoint
{
public int Value { get; set; }
public float Rotation { get; set; }
}
public class ArrowGeometry : BaseSVGPathGeometry
{
// a circle with an arrow in it, pointing up; the series fills and strokes it like the
// points of any line, so it covers the line, and OnPointMeasured turns it to the wind
private static SKPath _path = SKPath.ParseSvgPathData(
"M1 16 A15 15 0 1 0 31 16 A15 15 0 1 0 1 16 Z " + // the circle
"M16 25 L16 7 M9.5 13.5 L16 7 L22.5 13.5"); // the arrow, pointing up
public ArrowGeometry()
: base(_path)
{ }
}
Gaps
A null value creates a gap in the line, both a null number (double?, int?) and a null item in the
collection, such as a null ObservablePoint. This is controlled by EnableNullSplitting, which is true by
default; disabling it saves some work when your data never contains nulls.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.General.NullPoints.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.General.NullPoints;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlLineSeries Values="{Binding Values1}"/>
<lvc:XamlLineSeries Values="{Binding Values2}"/>
<lvc:XamlLineSeries Values="{Binding Values3}"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
using LiveChartsCore.Defaults;
namespace ViewModelsSamples.General.NullPoints;
public class ViewModel
{
public double?[] Values1 { get; set; } =
[5, 4, null, 3, 2, 6, 5, 6, 2];
public double?[] Values2 { get; set; } =
[2, 6, 5, 3, null, 5, 2, 4, null];
public ObservablePoint?[] Values3 { get; set; } =
[
new ObservablePoint { X = 0, Y = 1 },
new ObservablePoint { X = 1, Y = 4 },
null,
new ObservablePoint { X = 4, Y = 5 },
new ObservablePoint { X = 6, Y = 1 },
new ObservablePoint { X = 8, Y = 6 },
];
}
Step lines
A StepLineSeries takes the same properties as the line series, except LineSmoothness. All the paints, geometries,
gaps and data labels in this article work the same way on it.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MauiSample.StepLines.Basic.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.StepLines.Basic;assembly=ViewModelsSamples"
x:DataType="vms:ViewModel">
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart>
<lvc:CartesianChart.Title>
<lvc:XamlDrawnLabelVisual
Text="My chart title"
TextSize="25"
Padding="15"/>
</lvc:CartesianChart.Title>
<lvc:CartesianChart.Series>
<lvc:SeriesCollection>
<lvc:XamlStepLineSeries
Values="{Binding Values}"
Fill="{x:Null}"
GeometrySize="20"/>
</lvc:SeriesCollection>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
</ContentPage>
namespace ViewModelsSamples.StepLines.Basic;
public class ViewModel
{
public double[] Values { get; set; } =
[2, 1, 3, 4, 3, 4, 6];
}
Data labels
Data labels draw a label next to every point:

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null,
DataLabelsSize = 20,
DataLabelsPaint = new SolidColorPaint(SKColors.Blue),
// all the positions:
// https://livecharts.dev/api/2.2.0/LiveChartsCore.Measure.DataLabelsPosition
DataLabelsPosition = LiveChartsCore.Measure.DataLabelsPosition.Top,
// the formatter takes the point and returns the label text
DataLabelsFormatter = point => point.Coordinate.PrimaryValue.ToString("C2")
}
Data padding
DataPadding is the space between the first and last points and the edges of the chart, measured in axis ticks
(the distance between two separators). It is a LvcPoint, X for the horizontal edges and Y for the vertical ones.

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
DataPadding = new LvcPoint(0, 0), // mark
GeometryStroke = null,
GeometryFill = null,
Fill = null
}
Data, names and updates
Valuestakes anyIEnumerable<T>. Use anObservableCollection<T>and the chart animates every added, removed or replaced value, see automatic updates.- To plot your own types, or set both X and Y, see mappers.
Name(SeriesNamein XAML) is shown in tooltips and legends. When it is not set, the tooltip shows the values without a series name.ZIndexsets which series draws on top, andIsVisibleshows or hides the series.